package com.fjnldx.mes.domain.domainRes;

import org.springframework.stereotype.Component;

@Component
public class Result {
    private Integer code;
    private String msg;
    private String status;
    private Object data;

    public static Result success(Object data) {
        return new Result(1, "操作成功", "success", data);
    }

    public static Result error() {
        return new Result(-1, "操作失败", "success", null);
    }

    public static Result error(String message) {
        return new Result(-1, "操作失败", "error", message);
    }

    public Result() {
    }

    public Result(Integer code, String msg, String status, Object data) {
        this.code = code;
        this.msg = msg;
        this.status = status;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
